open class Base
class Derived extends Base
class Other

class X {
  function o(o: Any): Any = o

  function s(s: String, ss: String): String = s + ss

  function b(b: Boolean, c: Boolean): Boolean = b.xor(c)

  function n(n: Number, nn: Number): Number = n + nn
  function i(i: Int, ii: Int): Int = i + ii
  function f(e: Float, ee: Float): Float = e + ee

  function duration(d: Duration, dd: Duration): Duration = d + dd
  function dataSize(d: DataSize, dd: DataSize): DataSize = d + dd

  function collection(c: Collection, cc: Collection): Collection = c + cc
  function l(l: List, ll: List): List = l + ll
  function set(s: Set, ss: Set): Set = s + ss
  function map(m: Map, mm: Map): Map = m + mm

  function base(b: Base, bb: Base): Base = b
  function derived(d: Derived, dd: Derived): Derived = d
  function other(o: Other, oo: Other): Other = o
}

local x = new X {}

res1 = x.o("hello")
res3 = x.s("hello", "hello")

res4 = x.o(1)
res5 = x.n(1, 2)
res6 = x.i(1, 2)

res7 = x.o(1.2)
res8 = x.n(1.0, 1.2)
res9 = x.f(1.0, 1.2)

res10 = x.o(1.s)
res11 = x.duration(1.s, 3.s)

res12 = x.o(1.mb)
res13 = x.dataSize(1.mb, 2.mb)

res17 = x.o(List(1, 2))
res18 = x.collection(List(1, 2), List(3))
res19 = x.l(List(1, 2), List(3))

res20 = x.o(Set(1, 2))
res21 = x.collection(Set(1, 2), Set(3))
res22 = x.set(Set(1, 2), Set(3))

res23 = x.o(Map(1, 2))
res24 = x.map(Map(1, 2), Map(3, 4))

res25 = x.base(new Base {}, new Base {})
res26 = x.base(new Derived {}, new Derived {})
res27 = x.derived(new Derived {}, new Derived {})
